package com.controller;


import com.domain.*;
import com.webservice.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/equipment")
public class EquipmentController {

    @Resource
    private UserWebservice userWebservice;

    @Resource
    private OrderWebservice orderWebservice;

    @Resource
    private EquipmentWebservice equipmentWebservice;

    @Resource
    private BiddingWebservice biddingWebservice;

    @Resource
    private ProcessWebservice processWebservice;

    @RequestMapping("/Framework")
    public String Framework(HttpServletRequest request, Model model) {
        HttpSession session = request.getSession();
        User admin = (User) session.getAttribute("user");
        model.addAttribute("equip", admin);
        return "Equipment/Framework";
    }
    @RequestMapping("/log_v")
    public String log_v(HttpServletRequest request, Model model) {
        HttpSession session = request.getSession();
        User admin = (User) session.getAttribute("user");
        model.addAttribute("equip", admin);

        return "Equipment/log_v";
    }

    @RequestMapping("/role_page")
    public String role_page(HttpServletRequest request, Model model) {
        HttpSession session = request.getSession();
        User admin = (User) session.getAttribute("user");
        model.addAttribute("equip", admin);
        List<User> lists = new ArrayList<>();
        lists = userWebservice.findUserByState(2);
        //System.out.println("*****格式"+lists.size());
        model.addAttribute("users",lists);
        return "Equipment/role_page";
    }
}
